﻿<template>
  <a-modal
    :title="title"
    width="40%"
    :visible="visible"
    :confirmLoading="loading"
    @ok="handleSubmit"
    @cancel="()=>{this.visible=false}"
  >
    <a-spin :spinning="loading">
      <a-form-model ref="form" :model="entity" :rules="rules" v-bind="layout">
        <a-form-model-item label="通道商户号" prop="yqdm">
          <a-input v-model="entity.yqdm" autocomplete="off" />
        </a-form-model-item>
        <a-form-model-item label="AcctNo" prop="AcctNo">
          <a-input v-model="entity.AcctNo" autocomplete="off" />
        </a-form-model-item>
        <a-form-model-item label="CorpId" prop="CorpId">
          <a-input v-model="entity.CorpId" autocomplete="off" />
        </a-form-model-item>
        <a-form-model-item label="BankNode" prop="BankNode">
          <a-input v-model="entity.BankNode" autocomplete="off" />
        </a-form-model-item>
        <a-form-model-item label="BusiType" prop="BusiType">
          <a-input v-model="entity.BusiType" autocomplete="off" />
        </a-form-model-item>
        <a-form-model-item label="ServiceProviderId" prop="ServiceProviderId">
          <a-input v-model="entity.ServiceProviderId" autocomplete="off" />
        </a-form-model-item>
        <a-form-model-item label="Remark" prop="Remark">
          <a-input v-model="entity.Remark" autocomplete="off" />
        </a-form-model-item>
        <a-form-model-item label="BankName" prop="BankName">
          <a-input v-model="entity.BankName" autocomplete="off" />
        </a-form-model-item>
        <a-form-model-item label="gateway" prop="gateway">
          <a-input v-model="entity.gateway" autocomplete="off" />
        </a-form-model-item>
        <a-form-model-item label="merchantPriKey" prop="merchantPriKey">
          <a-input v-model="entity.merchantPriKey" autocomplete="off" />
        </a-form-model-item>
        <a-form-model-item label="easyPayPubKey" prop="easyPayPubKey">
          <a-input v-model="entity.easyPayPubKey" autocomplete="off" />
        </a-form-model-item>
        <a-form-model-item label="trxCd" prop="trxCd">
          <a-input v-model="entity.trxCd" autocomplete="off" />
        </a-form-model-item>
        <a-form-model-item label="merchantMD5Key" prop="merchantMD5Key">
          <a-input v-model="entity.merchantMD5Key" autocomplete="off" />
        </a-form-model-item>
        <a-form-model-item label="status" prop="status">
          <a-input v-model="entity.status" autocomplete="off" />
        </a-form-model-item>
        <a-form-model-item label="repayFee" prop="repayFee">
          <a-input v-model="entity.repayFee" autocomplete="off" />
        </a-form-model-item>
        <a-form-model-item label="notifyUrl" prop="notifyUrl">
          <a-input v-model="entity.notifyUrl" autocomplete="off" />
        </a-form-model-item>
        <a-form-model-item label="wallet_id" prop="wallet_id">
          <a-input v-model="entity.wallet_id" autocomplete="off" />
        </a-form-model-item>
        <a-form-model-item label="asset_id" prop="asset_id">
          <a-input v-model="entity.asset_id" autocomplete="off" />
        </a-form-model-item>
        <a-form-model-item label="pay_password" prop="pay_password">
          <a-input v-model="entity.pay_password" autocomplete="off" />
        </a-form-model-item>
        <a-form-model-item label="gomepayapp_code" prop="gomepayapp_code">
          <a-input v-model="entity.gomepayapp_code" autocomplete="off" />
        </a-form-model-item>
        <a-form-model-item label="gomepayapp_version" prop="gomepayapp_version">
          <a-input v-model="entity.gomepayapp_version" autocomplete="off" />
        </a-form-model-item>
        <a-form-model-item label="gomepayplat_form" prop="gomepayplat_form">
          <a-input v-model="entity.gomepayplat_form" autocomplete="off" />
        </a-form-model-item>
        <a-form-model-item label="gomepayservice_code" prop="gomepayservice_code">
          <a-input v-model="entity.gomepayservice_code" autocomplete="off" />
        </a-form-model-item>
        <a-form-model-item label="gomepayversion" prop="gomepayversion">
          <a-input v-model="entity.gomepayversion" autocomplete="off" />
        </a-form-model-item>
        <a-form-model-item label="gomepayVerifyKey" prop="gomepayVerifyKey">
          <a-input v-model="entity.gomepayVerifyKey" autocomplete="off" />
        </a-form-model-item>
        <a-form-model-item label="CashOutNotifyUrl" prop="CashOutNotifyUrl">
          <a-input v-model="entity.CashOutNotifyUrl" autocomplete="off" />
        </a-form-model-item>
        <a-form-model-item label="IsCashOut" prop="IsCashOut">
          <a-input v-model="entity.IsCashOut" autocomplete="off" />
        </a-form-model-item>
        <a-form-model-item label="BankId" prop="BankId">
          <a-input v-model="entity.BankId" autocomplete="off" />
        </a-form-model-item>
        <a-form-model-item label="upayPrivateKeyFileName" prop="upayPrivateKeyFileName">
          <a-input v-model="entity.upayPrivateKeyFileName" autocomplete="off" />
        </a-form-model-item>
      </a-form-model>
    </a-spin>
  </a-modal>
</template>

<script>
export default {
  props: {
    parentObj: Object
  },
  data() {
    return {
      layout: {
        labelCol: { span: 5 },
        wrapperCol: { span: 18 }
      },
      visible: false,
      loading: false,
      entity: {},
      rules: {},
      title: ''
    }
  },
  methods: {
    init() {
      this.visible = true
      this.entity = {}
      this.$nextTick(() => {
        this.$refs['form'].clearValidate()
      })
    },
    openForm(id, title) {
      this.init()

      if (id) {
        this.loading = true
        this.$http.post('/Base_leasesystem_servicebank/leasesystem_servicebank/GetTheData', { id: id }).then(resJson => {
          this.loading = false

          this.entity = resJson.Data
        })
      }
    },
    handleSubmit() {
      this.$refs['form'].validate(valid => {
        if (!valid) {
          return
        }
        this.loading = true
        this.$http.post('/Base_leasesystem_servicebank/leasesystem_servicebank/SaveData', this.entity).then(resJson => {
          this.loading = false

          if (resJson.Success) {
            this.$message.success('操作成功!')
            this.visible = false

            this.parentObj.getDataList()
          } else {
            this.$message.error(resJson.Msg)
          }
        })
      })
    }
  }
}
</script>
